let express = require("express")
let app = express()
app.use(express.static("public"))
app.use(express.urlencoded({extended:true}))

app.get("/test_get", (req, resp) => {
    console.log(req.query)
    resp.set("Access-Control-Allow-Origin", "http://127.0.0.1:3000")
    resp.send('我是get请求的响应')
})

app.post("/test_post", (req, resp) => {
    console.log(req.body)
    resp.set("Access-Control-Allow-Origin", "http://127.0.0.1:3000")
    resp.send('我是post请求的响应')
})

app.listen(3000, (err) => {
    if(!err){
        console.log("服务器启动成功了")
    }else{
        console.log(err)
    }
})